package upicgame.comment.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import upicgame.comment.dao.CommentDao;
import upicgame.entity.Comments;

import javax.annotation.Resource;
import java.util.List;

/*
 *Created by GHW
 *Description:Comments Service
 *2019/12/26 20:54
 */
@Service
@Transactional
public class CommentServiceImpl implements CommentService {
    @Resource
    private CommentDao cd;

    //添加评论
    @Override
    public Comments addComments(Integer uid, Integer gid, String comments) {
        return cd.addComments(uid, gid, comments);

    }

    //管理员显示所有评论接口
    @Override
    public List<Comments> showAllCommentsForAdmin() {
        return cd.showAllCommentsForAdmin();
    }

    //通过id查找评论
    @Override
    public Comments findCommentsById(Integer cid) {
        return cd.findCommentsById(cid);
    }

    //显示所有评论
    @Override
    public List<Comments> showAllComments(Integer gid) {
        return cd.showAllComments(gid);
    }


    //删除评论
    @Override
    public void delComments(Comments comments) {
        cd.delComments(comments);
    }

}
